package com.xique.system.api;

import com.xique.common.core.constant.ServiceNameConstants;
import com.xique.common.core.domain.R;
import com.xique.system.api.dto.SystemDictDataDTO;
import com.xique.system.api.factory.RemoteSystemDictFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author shd
 * @create 2021/12/29 10:20
 */
@FeignClient(contextId = "RemoteSystemDictService", value = ServiceNameConstants.SYSTEM_BIZ_SERVICE, fallbackFactory = RemoteSystemDictFallbackFactory.class)
public interface RemoteSystemDictService {

    /**
     * 获取字典
     * @author shd
     * @date 2021/12/29 10:36
     * @param dictType
     * @param dictValue
     * @return com.xique.common.core.domain.R<java.lang.String>
     */
    @GetMapping(value = "dict/data/label")
    R<String> getDictLabel(@RequestParam("dictType") String dictType,
                                     @RequestParam("dictValue") String dictValue);

    /**
     * 根据字典类型，获取字典值列表
     * @param dictType
     * @return
     */
    @GetMapping(value = "dict/data/getDictDataByType/{dictType}")
    R<List<SystemDictDataDTO>> getDictDataByType(@PathVariable("dictType") String dictType);
}
